<?php
$con=mysql_connect('localhost','root','');
if(!$con)
{
  die('could not connect:'.mysql_error());
  }
  mysql_select_db("etrawelmart",$con);
  
  
$userid=$_POST['email_to'];

 $sql=mysql_query("SELECT * FROM customers WHERE email='$userid'") or die(' no id exists'.mysql_error);;
  
 
  
 $row=mysql_fetch_array($sql); 
  $username=$row['username'];
  $passwrd=$row['password'];
 
 



 $to = $userid;
  $subject = "Your Password @ etrawels";
 $body = "Hi $username, your password for the login to our website is: $passwrd";


 if (mail($to, $subject, $body)) {
	 ?>
  <script language="javascript"> 
		 alert("You password has been sent to your email ID"); window.location.href='booking.php'; </script> <?php
		 
		 
  } else {
   ?> <script language="javascript"> 
		 alert("Message Delivery failed"); window.location.href='booking.php'; </script> <?php
  }
  
  
  
  
  
  mysql_close($con);
  
  
  
 ?>